/*
	PCI_tables.h

	contains headers for system PCI configuration tables

	Author: Aidan Goddard 25/1/14
*/

#ifndef PCI_TABLES_H_INCLUDED
#define PCI_TABLES_H_INCLUDED

// device details table
struct __attribute__((__packed__,aligned(32))) PCIE_DEVICES
{
	HANDLE 		handle;
	uint64_t 	config_base_address;
	uint32_t 	class_code;

	uint16_t 	function : 3;
	uint16_t 	device : 5;
	uint16_t 	bus : 8;

	uint16_t 	vendor_id;
	uint16_t 	device_id;
	uint16_t 	IRQ_pin;
};

// device reservation tables
struct __attribute__((__packed__,aligned(16))) PCIE_DEVICES_RESERVATIONS
{
	uint64_t key; // reservation key. given when reserved, required to unreserve
	uint32_t is_reserved; // 0 = free, 1 = reserved
	uint32_t reserved_by; // 0xffffffff = system reserved (bridges, mostly).
};


#endif
